package com.huawei;

import java.io.*;

/**
 * Description: HJ2 计算某字符出现次数
 *
 * @author weiruibai.vendor
 * Date: 2022/8/5 17:13
 */
public class HJ2 {

    public static void main(String[] args) throws IOException {
        BufferedReader reader =
                new BufferedReader(new InputStreamReader(System.in));
        String str;

        while ((str = reader.readLine()) != null && str != "") {
            str = str.toLowerCase();
            String secondLine = reader.readLine();
            int ans = 0;
            for (int i = 0; i < str.length(); i++) {
                if (String.valueOf(str.charAt(i) + "").equals(secondLine)) {
                    ans++;
                }

            }
            System.out.println(ans);
        }
    }

    private static void test2() throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String s1 = reader.readLine();
        String s2 = reader.readLine();
        int res = s1.length() - s1.replaceAll(s2, "").length();
        System.out.println(res);
    }
}
